<script type="text/javascript">
    var startTime = new Date();
    (function main () {
    var a = 0;
    for (var i = 0; i < 999999999; i++) {
        a += i;
    }
    console.log(a);
    })();
    var endTime = new Date();
    console.log((endTime.getTime() - startTime.getTime()) / 1000);
</script>